<!--
  @author yangjiangming
  @date 2018-12-10 20:40:28
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html th:replace="~{work/modify/common/layout :: layout('false', ~{::title}, ~{::content}, ~{::script})}">
<head>
    <title>工单-返修厂商单</title>

    <link rel="stylesheet" href="/static/style/order/order.css" media="all">

</head>
<body>

<div th:fragment="content">
    <div class="layui-fluid new-order-page">
        <div class="layui-card">
            <form id="updateOrderAction" method="post" class="layui-form" lay-filter="zmn-order-add-form">

                <input type="hidden" name="platWork" id="platWork" th:value="${orderInfo.platWork}"/>
                <input type="hidden" name="plat" id="plat" th:value="${orderInfo.plat}"/>
                <input type="hidden" name="longitude" id="longitude" th:value="${orderInfo.longitude}"/>
                <input type="hidden" name="latitude" id="latitude" th:value="${orderInfo.latitude}"/>
                <input type="hidden" name="channelId" id="channelId" th:value="${orderInfo.channelId}"/>

                <input type="hidden" id="district"/>

                <!-- 新单/返修 -->
                <input type="hidden" name="type" id="type" th:value="${orderInfo.type}"/>
                <input type="hidden" name="reworkId" id="reworkId" th:value="${orderInfo.reworkId}"/>
                <!--地址info-->
                <input type="hidden" id="streetSource" name="streetSource" th:value="${orderInfo.streetSource}">
                <input type="hidden" id="communityId" th:value="${orderInfo.streetId}">
                <!--<div class="layui-card-header" style="margin-top:10px;"><b>基本信息</b></div>-->
                <div class="layui-split">&nbsp;</div>

                <div th:with="product=${orderInfo.orderProductList[0]}">


                    <!-- 联系电话 -->
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label layui-form-required">联系电话</label>
                            <div class="layui-input-inline" style="width: 200px;">
                                <!-- 联系电话1 -->
                                <th:block th:replace="common/_orderAddTmpl :: inputOfTelephone1"/>
                            </div>
                            <label class="layui-form-label">联系电话</label>
                            <div class="layui-input-inline" style="width: 200px;">
                                <!-- 联系电话2 -->
                                <input class="layui-input"
                                       id="telephone2"
                                       type="text"
                                       name="telephone2"
                                       th:value="${orderInfo.telephone2}"
                                       lay-verify="tel"
                                       placeholder="电话02"
                                       autocomplete="off" >
                            </div>
                            <div class="layui-input-inline" style="width: 190px;">
                                <!-- 联系电话3 -->
                                <input class="layui-input"
                                       id="telephone3"
                                       type="text"
                                       name="telephone3"
                                       th:value="${orderInfo.telephone3}"
                                       lay-verify="tel"
                                       placeholder="电话03"
                                       autocomplete="off" >
                            </div>
                        </div>
                    </div>
                    <!-- 用户姓名、下单渠道 -->
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label layui-form-required">客户姓名</label>
                            <div class="layui-input-inline" style="width: 200px;">
                                <th:block th:replace="common/_orderAddTmpl :: inputOfUserName"/>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label layui-form-required">厂商</label>
                                <div class="layui-input-inline" style="width: 410px;">
                                    <select id="factoryId" name="factoryId" lay-verify="required" lay-filter="factoryId" lay-search disabled>
                                        <option value=""></option>
                                        <option th:each="item : ${factoryList}"
                                                th:value="${item.value}"
                                                th:text="${item.text}"
                                                th:selected="${item.value} == ${orderInfo.orderFactory.factoryId}"
                                                th:disabled="${item.disabled}">
                                        </option>
                                    </select>
                                </div>

                                <div class="layui-input-inline" style="width: 170px;">
                                    <input type="radio"
                                           name="bizType"
                                           id="bizType"
                                           th:each="item : ${bizTypeList}"
                                           th:value="${item.value}"
                                           th:title="${item.text}"
                                           th:checked="${item.value} == ${orderInfo.bizType}"
                                           lay-verify="required"
                                           disabled>
                                </div>

                            </div>


                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-inline" style="width: 350px;">
                            <!-- 用户性别 -->
                            <label class="layui-form-label">性别</label>
                            <input type="radio"
                                   name="gender"
                                   th:each="item : ${gender}"
                                   th:value="${item.value}"
                                   th:title="${item.text}"
                                   th:checked="${item.value == orderInfo.gender}">
                        </div>
                    </div>
                    <!-- 用户地址-省、市 -->
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label layui-form-required">用户地址</label>
                            <div class="layui-input-inline" style="width: 200px;">
                                <select id="provinceId" name="provinceId" lay-verify="required" lay-filter="province" lay-search>
                                    <option value="">省</option>
                                    <option th:each="province : ${provinceList}"
                                            th:value="${province.value}"
                                            th:text="${province.text}"
                                            th:selected="${province.value == orderInfo.provinceId}">
                                    </option>
                                </select>
                            </div>
                            <div class="layui-input-inline" style="width: 295px;">
                                <select id="cityId" name="cityId" lay-verify="required" lay-filter="city" lay-search>
                                    <option value="">市</option>
                                    <option th:each="city : ${cityList}"
                                            th:value="${city.value}"
                                            th:text="${city.text}"
                                            th:selected="${city.value == orderInfo.cityId}">
                                    </option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <!-- 用户地址-区县、街道 -->
                    <div id="fuzzy-address" class="layui-form-item"  th:classappend="${(orderInfo.streetSource == 0 && orderInfo.streetId == 0) || orderInfo.streetSource != 3} ? 'layui-hide'">
                        <div class="layui-inline">
                            <label class="layui-form-label"></label>
                            <div class="layui-input-inline" style="width: 200px;">
                                <select id="countyId" name="countyId" lay-filter="countyId" lay-search  th:value="${orderInfo.countyId}">
                                    <option value="">请选择区县</option>
                                    <option th:each="county : ${countyList}"
                                            th:value="${county.value}"
                                            th:text="${county.text}"
                                            th:selected="${county.value == orderInfo.countyId}">
                                    </option>
                                </select>
                            </div>
                            <div class="layui-input-inline" style="width: 315px;">
                                <select id="streetId"
                                        name="streetId"
                                        lay-filter="streetId"
                                        lay-search
                                        th:value="${orderInfo.streetId}">
                                    <option value="">请选择乡镇或街道</option>
                                    <option th:each="street : ${streetList}"
                                            th:value="${street.areaId}"
                                            th:text="${street.name}"
                                            th:data-longitude="${street.longitude}"
                                            th:data-latitude="${street.latitude}"
                                            th:selected="${street.areaId == orderInfo.streetId}">
                                    </option>
                                </select>
                            </div>
                        </div>
                    </div>

                    <!-- 用户地址-map -->
                    <div id="exact-address" class="layui-form-item" th:classappend="${(orderInfo.streetSource == 0 && orderInfo.streetId != 0) || orderInfo.streetSource == 3} ? 'layui-hide'">
                        <div class="layui-inline">
                            <label class="layui-form-label" ></label>
                            <div class="layui-input-inline input-large" id="street-wrapper">
                                <input class="layui-input"
                                       id="customerAddress"
                                       type="text"
                                       name="street"
                                       th:value="${orderInfo.street}"
                                       lay-verify="required"
                                       placeholder="搜索地点，选择小区，街道，大厦..."
                                       autocomplete="off"
                                       style="padding-right: 95px;">

                                <!--搜索建议-->
                                <button id="btn-map" class="layui-btn layui-btn-normal" style="position: absolute;top: 0;right: 0;">百度地图</button>
                                <div id="suggestPanel" class="suggestPanelBox layui-anim layui-anim-upbit">
                                    <ul></ul>
                                </div>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <div class="layui-input-inline" id="county-list">
                            </div>
                        </div>
                    </div>
                    <!-- 用户地址-门牌 -->
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label"></label>
                            <div class="layui-input-inline input-large">
                                <input class="layui-input"
                                       type="text"
                                       name="address"
                                       th:value="${orderInfo.address}"
                                       maxlength="100"
                                       placeholder="请输入详细楼栋、门牌号"
                                       autocomplete="off"
                                       lay-verify="required">
                            </div>
                        </div>
                    </div>
                    <!-- 切换精确地址与模糊地址 -->
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label"></label>
                            <div class="layui-input-inline input-large">
                                <a class="btn-duty-time"  th:classappend="${(orderInfo.streetSource == 0 && orderInfo.streetId != 0) || orderInfo.streetSource == 3} ? 'layui-hide'" id="address-type-exact" href="javascript:void(0);">无法找到精确地址</a>
                                <a class="btn-duty-time"  th:classappend="${(orderInfo.streetSource == 0 && orderInfo.streetId == 0) || orderInfo.streetSource != 3} ? 'layui-hide'" id="address-type-fuzzy" href="javascript:void(0);" >切换为精确地址</a>
                            </div>
                        </div>
                    </div>

                    <!-- 服务产品、产品数量、品牌 -->
                    <div class="layui-form-item">
                        <div class="layui-inline">

                            <label class="layui-form-label layui-form-required">服务产品</label>
                            <div class="layui-input-inline" style="width: 200px;">
                                <select id="servCategoryId" name="servCategId" lay-verify="required" lay-filter="servCategory" lay-search>
                                    <option value="">全部</option>
                                    <option th:each="item : ${servCategList}"
                                            th:value="${item.value}"
                                            th:text="${item.text}"
                                            th:selected="${item.value == orderInfo.servCategId}">
                                    </option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <div class="layui-input-inline" style="width: 200px;">
                                <select id="productId" name="productId" lay-verify="required" lay-filter="productId" lay-search>
                                    <option value="">全部</option>
                                    <option th:each="item : ${productList}"
                                            th:value="${item.value}"
                                            th:text="${item.text}"
                                            th:selected="${item.value == orderInfo.productId}"
                                        >
                                    </option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label layui-form-required" >产品数量</label>
                            <div class="layui-input-inline" style="width: 170px;">
                                <input class="layui-input"
                                       id="count"
                                       type="text"
                                       name="number"
                                       placeholder="请填写数量"
                                       autocomplete="off"
                                       min="1"
                                       max="10"
                                       lay-verify="required|count"
                                       style="padding-right: 40px"
                                       th:value="${product.number}">
                                <span class="order-number-unit" id="unit"></span>
                            </div>
                    </div>

                    <!-- 常见故障-->
                    <div class="layui-form-item" th:styleappend="${subsidiaryList == null || subsidiaryList.isEmpty() } ? 'display: none' ">
                        <div class="layui-inline">
                            <label class="layui-form-label" >常见故障</label>
                            <div class="layui-input-block faults-wrapper" id="faults-wrapper">
                                <input type="checkbox"
                                       name="faultIdList"
                                       lay-skin="primary"
                                       th:each="fault : ${subsidiaryList}"
                                       th:title="${fault.text}"
                                       th:value="${fault.value}"
                                       th:checked="${product.faultIdList != null && product.faultIdList.contains(fault.value)}">
                            </div>
                        </div>
                    </div>
                    <!-- 其他故障 -->
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">其他故障</label>
                            <div class="layui-input-inline" style="width: 725px;">
                                <textarea class="layui-textarea"
                                          id="fault-remark"
                                          name="faultRemark"
                                          th:text="${product.remark}"
                                          placeholder="最长不能超过300个字"
                                          maxlength="300"
                                          lay-verify="maxLenTo300"></textarea>
                            </div>
                        </div>
                    </div>
                        <!-- 预约时间 -->
                        <div class="layui-form-item duty-time-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">预约时间</label>
                                <div class="layui-input-inline layui-inline-text" id="duty-time-wrapper">
                                    <input type="hidden" name="dutyStatus" th:value="2"/>
                                    <span id="duty-time" th:text="${dutyTime}"></span>
                                    <a class="btn-duty-time" id="btn-duty-time" href="javascript:void(0);">选择预约时间</a>
                                    <button class="layui-btn" style="padding: 0;"></button>
                                    <input id="duty-time-input"
                                           type="hidden"
                                           name="dutyTime"
                                           th:value="${dutyTime}"
                                           lay-verify="dutyTime"
                                           style="padding: 0;">
                                </div>
                                <div class="layui-input-inline">
                                    <input id="duty-time-checkbox"
                                           type="checkbox"
                                           lay-skin="primary"
                                           name=""
                                           lay-filter="duty-time-checkbox"
                                           title="客户不确定上门时间">
                                </div>
                            </div>
                        </div>

                        <!-- 下单备注 -->
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">下单备注</label>
                            <div class="layui-input-inline input-large">
                                <textarea class="layui-textarea" name="remark" th:text="${orderInfo.remark}" placeholder="最长不能超过500个字" maxlength="500" lay-verify="maxLenTo500"></textarea>
                            </div>
                            <span style="color: red;">注意：此处备注工程师APP、用户可见。</span>
                        </div>
                    </div>
                    <!-- 按钮 -->
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <div>
                                <button id="confirmbtn" type="submit" class="layui-btn" lay-submit lay-filter="confirmbtn">保存</button>
                                <!--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
                            </div>
                        </div>
                    </div>
                    <div style="height: 1px"></div>
                </div>
            </form>
        </div>
    </div>
</div>

<script th:inline="javascript">
    var json = {
        cityList: [[${cityList}]]
    };

    layui.config({
        base: "/static/js/module/",
        version: 20221013001
    }).extend({
        oms_order_factoryAdd: "order/zmn.oms.order.factoryAdd"
    }).use(['index', 'oms_order_factoryAdd']);
</script>

</body>
</html>